package Aleehot100;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * ClassName: c01
 * Package: Aleehot100
 * Description:
 *
 * @Author BCXJ
 * @Create 2025/5/20 08:45
 * @Version 1.0
 * @Since 1.0
 */
public class c01 {


    HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
    // 两数之和

    public int[] twoSum(int[] nums, int target) {

        int l = 0, r = 0, n = nums.length, sum = 0;
        for (int i = l; i < n; i++) {
            if(map.containsKey(target - nums[i])) {
                return new int[]{map.get(target - nums[i]), i};
            }
            map.put(nums[i], i);
        }

        return new int[]{0};
    }





}
